package com.xtayfjpk.thrift.test.server;

import org.apache.thrift.TProcessor;
import org.apache.thrift.protocol.TBinaryProtocol;
import org.apache.thrift.server.TServer;
import org.apache.thrift.server.TSimpleServer;
import org.apache.thrift.transport.TServerSocket;

import com.xtayfjpk.thrift.test.service.HelloWorldService;
import com.xtayfjpk.thrift.test.service.HelloWorldService.Iface;
import com.xtayfjpk.thrift.test.service.HelloWorldServiceImpl;

public class HelloWorldServer {

	public static void main(String[] args) throws Exception {
		TProcessor tProcessor = new HelloWorldService.Processor<Iface>(new HelloWorldServiceImpl());
		
		TServerSocket serverSocket = new TServerSocket(8090);
		
		TServer.Args tArgs = new TServer.Args(serverSocket);
		tArgs.processor(tProcessor);
		tArgs.protocolFactory(new TBinaryProtocol.Factory());
		
		TServer server = new TSimpleServer(tArgs);
		
		server.serve();
	}

}
